{% extends 'base.html' %}

{% block content %}
  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item active" aria-current="page">My Quizzes</li>
    </ol>
  </nav>
  <h2 class="mb-3">My Quizzes</h2>
  <a href="{% url 'teachers:quiz_add' %}" class="btn btn-primary mb-3" role="button">Add quiz</a>
  <div class="card">
    <table class="table mb-0">
      <thead>
        <tr>
          <th>Quiz</th>
          <th>Subject</th>
          <th>Questions</th>
          <th>Taken</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for quiz in quizzes %}
          <tr>
            <td class="align-middle"><a href="{% url 'teachers:quiz_change' quiz.pk %}">{{ quiz.name }}</a></td>
            <td class="align-middle">{{ quiz.subject.get_html_badge }}</td>
            <td class="align-middle">{{ quiz.questions_count }}</td>
            <td class="align-middle">{{ quiz.taken_count }}</td>
            <td class="text-right">
              <a href="{% url 'teachers:quiz_results' quiz.pk %}" class="btn btn-primary">View results</a>
            </td>
          </tr>
        {% empty %}
          <tr>
            <td class="bg-light text-center font-italic" colspan="5">You haven't created any quiz yet.</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
{% endblock %}
